<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="renderer" content="webkit">
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" type="text/css" charset="UTF-8" href="/resource/layui/css/layui.css">
<link rel="stylesheet" type="text/css" charset="UTF-8" href="/resource/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" charset="UTF-8" href="/resource/css/common.css">
<link rel="stylesheet" type="text/css" charset="UTF-8" href="/resource/css/gloab.css" />
</head>

<body>
	<div class="" style="margin-left: 15px;">
		<fieldset class="layui-elem-field layui-field-title">
			<legend>通知管理</legend>
		</fieldset>
		<form class="layui-form layui-form-pane" action="/cpinstitution/save" id="commonForm">
			<div class="layui-form-item">
				<label class="layui-form-label">制度文件名称</label>
				<div class="layui-input-block">
					<input type="text" name="name" autocomplete="off" placeholder="请输入决议标题" class="layui-input" maxlength="50" value="${m.name }">
					<input type="hidden" name="id" value="${m.id }" />
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">收阅部门</label>
				<div class="layui-input-block" class="ckbox" id="sydepartdiv">
					<input type="hidden" name="sydepart" autocomplete="off" class="layui-input" maxlength="10" value="" />
					<input type="checkbox" id="sydepart" lay-skin="primary" autocomplete="off" class="layui-input" maxlength="10" value="" title="全部部门" lay-filter="departAllChose">
					<c:forEach items="${deplist }" var="s">
						<input type="checkbox" lay-skin="primary" autocomplete="off" class="layui-input" maxlength="10" value="${s.dname }" title="${s.dname }" lay-filter="departChose">
	      			</c:forEach>
				</div>
			</div>
			
			<div class="layui-form-item">
				<label class="layui-form-label">发布部门</label>
				<div class="layui-input-block">
					<select name="department" lay-verify="department" >
						<option value="">---请选择---</option>
						<c:forEach items="${deplist }" var="s">
							<option value="${s.dname}">${s.dname }</option>
						</c:forEach>
					</select>
				</div>
			</div>

			<div class="layui-form-item">
			    <label class="layui-form-label">有效期</label>
			    <div class="layui-input-block">
			        <input type="text" name="yxqdate"  placeholder="yyyy-MM-dd" autocomplete="off" readonly="readonly" value='<fmt:formatDate pattern="yyyy-MM-dd" value="${m.yxqdate}" />' class="layui-input" onclick="layui.laydate({elem: this, istime: true, format: 'YYYY-MM-DD'})">
			    </div>
			  </div>


			<div class="layui-form-item">
				<label class="layui-form-label">签署人</label>
				<div class="layui-input-block">
					<input type="text" name="qsr" lay-verify="uname" autocomplete="off" placeholder="不超过20位" class="layui-input" maxlength="10"
						value="${m.qsr }">
				</div>
			</div>

			<%-- <div class="layui-form-item">
				<label class="layui-form-label">发布内容</label>
				<div class="layui-input-block">
					<textarea id="content" name="content_one" style="display: none;" placeholder="请输入内容">${m.content }</textarea>
				</div>
			</div> --%>
			
			<div class="layui-form-item">
				<label class="layui-form-label">发布内容</label>
				<div class="layui-input-block">
					<textarea class="layui-textarea" lay-verify="question_content"  id="content_one" name="content" placeholder="请输入内容">${m.content }</textarea>
				</div>
			</div>
			
			<div class="layui-form-item clearfix">
  		  		<div class="xbzx_btn_save_group">
				  <button class="layui-btn save" xbzx-data-type="save" lay-submit="" lay-filter="commonSubmit">保存</button>
				  <a class="layui-btn cancel" href="javascript:;" xbzx-data-type="cancel" lay-filter="">取消</a>
			  	</div>
			</div>
		</form>
	</div>
	<script src="/resource/js/jquery/jquery-1.9.1.js" charset="utf-8" type="text/javascript"></script>
	<script src="/resource/layui/layui.js" charset="utf-8" type="text/javascript"></script>
	<script type="text/javascript">
			window.onload = function() {
			   layui.config({
					base: '/resource/js/xbzx_modules/' //xbzx模块目录
				}).use(['commonsubmit']); 
	
				layui.config({
					base: '/resource/js/xbzx_modules/' //xbzx模块目录
				}).use('xbzx-cms-form'); //加载formJs文件入口
			};
			
			$(function(){
				$('select[name="department"]').val("${m.department}");
				/* 全选 */
				$('#sydepart').click(function(){
					if($(this).attr("checked")=="checked"){
						  $("input:checkbox").attr("checked", true);
					}else{
						  $("input:checkbox").removeAttr("checked");
					}
				});
				var arr = '${m.sydepart}';
				/* 复选框 */
				if(arr.length>0){
					$.each(arr.split(","),function(i,v){
						  $("#sydepartdiv input[value='"+v+"']:checkbox").attr("checked", true);
					});
					
				}
				
				/* 全选 */
				$('#level').click(function(){
					if($(this).attr("checked")=="checked"){
						  $("input:checkbox").attr("checked", true);
					}else{
						  $("input:checkbox").removeAttr("checked");
					}
				});
				var arr = '${m.level}';
				console.log(arr);
				/* 复选框 */
				if(arr.length>0){
					$.each(arr.split(","),function(i,v){
						  $("#leveldiv input[value='"+v+"']:checkbox").attr("checked", true);
					});
					
				}
				
			});
			
		</script>
</body>
</html>
